# coding: utf-8
from PySide6.QtWidgets import QWidget, QHBoxLayout
from qfluentwidgets import HorizontalSeparator, BodyLabel


class NullDataWidget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.horizontalLayout = QHBoxLayout(self)
        self.bodyLabel = BodyLabel('暂无数据', self)

        self.horizontalLayout.addWidget(HorizontalSeparator(self), 1)
        self.horizontalLayout.addSpacing(20)
        self.horizontalLayout.addWidget(self.bodyLabel)
        self.horizontalLayout.addSpacing(20)
        self.horizontalLayout.addWidget(HorizontalSeparator(self), 1)

        self.setFixedHeight(40)

    def setText(self, text: str):
        self.bodyLabel.setText(text)


if __name__ == '__main__':
    import sys
    from PySide6.QtWidgets import QApplication

    app = QApplication(sys.argv)
    w = NullDataWidget()
    w.setStyleSheet('background-color: #ffffff')
    w.show()
    sys.exit(app.exec())
